package com.aos.erp.schools.model.student.ro.page;

import com.aos.erp.schools.model.student.ro.userId.UserRo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.util.StringUtils;

import java.io.Serializable;

/**
 * @Auther: chb
 * @Date: 2018/11/5 10:16
 * @Description:  前段分页参数
 */
@Data
public class PageRo extends UserRo implements Serializable {

    @ApiModelProperty(value = "当前页码", required = true, dataType = "Integer")
    private Integer pageIndex = 1;
    @ApiModelProperty(value = "每页查询数量", required = true, dataType = "Integer")
    private Integer pageSize = 20;

    public Integer getPageIndex() {
        if(StringUtils.isEmpty(pageIndex))
        {
            return  pageIndex = 1;
        }
        return pageIndex;
    }

    public void setPageIndex(Integer pageIndex) {
        if(StringUtils.isEmpty(pageIndex))
        {
            this.pageIndex = 1;
        }else
            {
                this.pageIndex = pageIndex;
            }
    }

    public Integer getPageSize() {
        if(StringUtils.isEmpty(pageSize))
        {
            return pageSize =20;
        }
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {

        if(StringUtils.isEmpty(pageIndex))
        {
            this.pageSize =20;
        }else
        {
            this.pageSize = pageSize;
        }

    }

}
